package com.fzdy.dataplatform.service.impl;

import com.fzdy.dataplatform.core.dao.Dao;
import com.fzdy.dataplatform.core.service.impl.BaseServiceImpl;
import com.fzdy.dataplatform.core.vo.Page;
import com.fzdy.dataplatform.dao.DeviceConfigDao;
import com.fzdy.dataplatform.entity.DeviceConfig;
import com.fzdy.dataplatform.service.DeviceConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;

@Service
@Transactional
public class DeviceConfigServiceImpl extends BaseServiceImpl<DeviceConfig> implements DeviceConfigService {

    @Autowired
    private DeviceConfigDao deviceConfigDao;

    @Override
    protected Dao getDao() {
        return deviceConfigDao;
    }

    @Override
    public void getPageByExampleEq(DeviceConfig query, Page<DeviceConfig> page) {
        List<DeviceConfig> list = deviceConfigDao.findByExampleEq(page.getCreatedate(),query, page.getPageCurrent(), page.getPageSize());
        long count = deviceConfigDao.countByExampleEq(page.getCreatedate(),query);
        page.setList(list);
        page.setTotalRow(Long.valueOf(count));
    }
}
